<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('数据管理列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
<!--                        <li>-->
<!--                            <label>报单编号：</label>-->
<!--                            <input type="text" name="decNo"/>-->
<!--                        </li>-->
                        <!--                            <li>-->
                        <!--                                <label>活动编号：</label>-->
                        <!--                                <input type="text" name="decActivityNo"/>-->
                        <!--                            </li>-->
                        <li>
                            <label>活动名称：</label>
                            <select name="decActivityName" class="form-control m-b" th:with="type=${@dict.getActivity()}">
                                <option th:each="dict : ${type}" th:text="${dict.getActName()}"
                                        th:value="${dict.getActName()}"></option>
                            </select>                        </li>
                        <li>
                            <label>报单类型：</label>
                            <select name="decType" th:with="type=${@dict.getType('sys_oper_dec_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>vip卡号：</label>
                            <input type="text" name="decVipCardNo"/>
                        </li>
                        <li>
                            <label>单号：</label>
                            <input type="text" name="decOrderNo"/>
                        </li>
                        <li>
                            <label>品牌：</label>
                            <input type="text" name="decBrand"/>
                        </li>
                        <li>
                            <label>客户姓名：</label>
                            <input type="text" name="decCustomerName"/>
                        </li>
                        <li>
                            <label>客户电话：</label>
                            <input type="text" name="decTelphone"/>
                        </li>
                        <li>
                            <label>录单人姓名：</label>
                            <input type="text" name="decPersonName"/>
                        </li>

                        <li>
                            <label>报单状态：</label>
                            <select name="decStatus" th:with="type=${@dict.getType('sys_oper_dec_status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:declaration:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:declaration:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:declaration:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:declaration:export">
                <i class="fa fa-download"></i> 导出
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.cancelAll()"
               shiro:hasPermission="system:declaration:cancel">
                <i class="fa fa-download"></i> 作废
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.chargeOff()"
               shiro:hasPermission="system:declaration:chargeOff">
                <i class="fa fa-download"></i> 核销
            </a>
            <a class="btn btn-primary multiple disabled" onclick="$.operate.chargeOffBatch()"
               shiro:hasPermission="system:declaration:batchChargeOff">
                <i class="fa fa-download"></i> 批量核销
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.agentMaintain()"
               shiro:hasPermission="system:declaration:agentMaintain">
                <i class="fa fa-download"></i> 管理员维护
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:declaration:edit')}]];
    var agentMaintainFlag = [[${@permission.hasPermi('system:declaration:agentMaintain')}]];
    var removeFlag = [[${@permission.hasPermi('system:declaration:remove')}]];
    var cancelFlag = [[${@permission.hasPermi('system:declaration:cancel')}]];
    var chargeOffFlag = [[${@permission.hasPermi('system:declaration:chargeOff')}]];
    var decTypeDatas = [[${@dict.getType('sys_oper_dec_type')}]];
    var decSignTypeCodeDatas = [[${@dict.getType('sys_oper_dec_sign_type')}]];
    var decSignTypeNameDatas = [[${@dict.getType('sys_oper_dec_sign_type')}]];
    var decStatusDatas = [[${@dict.getType('sys_oper_dec_status')}]];
    var delFlagDatas = [[${@dict.getType('sys_oper_yes_no')}]];
    var prefix = ctx + "system/declaration";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            agentMaintainUrl: prefix + "/agentMaintain/{id}",
            removeUrl: prefix + "/remove",
            cancelUrl: prefix + "/cancel",
            chargeOffUrl: prefix + "/chargeOff/{id}",
            chargeOffBatchUrl: prefix + "/chargeOffBatch",
            exportUrl: prefix + "/export",
            modalName: "报单数据管理",
            columns: [{
                checkbox: true
            },
                {
                    field: 'decId',
                    title: 'id',
                    visible: false
                },


                {
                    field: 'decActivityName',
                    title: '活动名称'
                },
                {
                    field: 'decType',
                    title: '报单类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(decTypeDatas, value);
                    }
                },
                {
                    field: 'decType',
                    title: '军团/联盟名称'
                },                {
                    field: 'decVipCardNo',
                    title: 'vip卡号'
                },
                {
                    field: 'decOrderNo',
                    title: '单号'
                },
                {
                    field: 'decBrand',
                    title: '品牌'
                },
                {
                    field: 'decAmount',
                    title: '金额'
                },
                {
                    field: 'decCustomerName',
                    title: '客户姓名'
                },
                {
                    field: 'decPersonName',
                    title: '录单人姓名'
                },

                {
                    field: 'createBy',
                    title: '报单人账号'
                },
                {
                    field: 'decAgentPersonName',
                    title: '带单品牌'
                },
                {
                    field: 'decAgentPersonName',
                    title: '带单人姓名'
                },
                {
                    field: 'decGift',
                    title: '奖品'
                },

                {
                    field: 'decStatus',
                    title: '报单状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(decStatusDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.decId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.decId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>